<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:pe="http://primefaces.org/ui/extensions" >
<h:head>
	<title>List Participations</title>
</h:head>
<h:body>
	<h:link value="PERSONAL HOME" outcome="index" />
	<h:form id="formSearch">
		<p:messages id="msgs" autoUpdate="true"/>
		<h:panelGrid columns="3">
			<p:outputLabel for="idPackage" value="Package ID: " />
			<p:inputText id="idPackage" value="#{listParticipations.idPackage}" label="Package ID"
					converterMessage="Please insert a valid ID number.">
					<f:convertNumber integerOnly="true" type="number"/>
			</p:inputText>
			<p:message for="idPackage" display="icon"/>
			
      		<p:commandButton value="Submit" update=":formView" action="#{listParticipations.init()}" />
		</h:panelGrid>
	</h:form>
	<br />
 	<h:form id="formView">
		<f:event type="preRenderView" listener="#{listParticipations.init()}" />
	
        <p:dataTable id="dataTableParticipations" var="participation" value="#{listParticipations.participations}"  
                 paginator="true" rows="15"
                 paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink}
                 {PageLinks} {NextPageLink} {LastPageLink}" >

        <f:facet name="header">  
            List participations
        </f:facet>  
  
        <p:column sortBy="email" headerText="Email">
            <h:outputText value="#{participation.user.email}" />  
        </p:column>  
  
        <p:column sortBy="name" headerText="Name">
            <h:outputText value="#{participation.user.name}" />  
        </p:column>
        
        <p:column sortBy="surname" headerText="Surname">
            <h:outputText value="#{participation.user.surname}" />  
        </p:column>
        
        <p:column sortBy="reservations" headerText="Reservations">
            <h:outputText value="#{participation.reservations}" />
        </p:column>
    	</p:dataTable>
	</h:form>
</h:body>
</html>